package com.hfkh;

import java.util.Arrays;

/**
 * @Author MDD
 * @Description
 * @Version
 * @Date
 **/
public class No_6 {
    public static void main(String[] args) {
        int[] arr11 = {1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 3, 2, 4, 5, 6, 7, 4, 32, 2, 1, 1, 4, 6, 3};
        int[] arr12 = new int[0];
        boolean isRepeat = false;//重复为false
        int index = 0;
        for (int i = 0; i < arr11.length; i++) {
            isRepeat = false;//初始化isRepeat
            for (int j = i + 1; j < arr11.length; j++) {
                if (arr11[i] == arr11[j]) {
                    isRepeat = true;//为真 比一次跳出
                    break;
                }
            }
            if (!isRepeat) {
                arr12 = Arrays.copyOf(arr12, arr12.length + 1);//新数组长度+1
                arr12[index++] = arr11[i];//用下标添加值
            }
        }
        System.out.println(Arrays.toString(arr12));
    }
}
